/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package BusinessTier;

import DataTier.IBGEDAO;
import EntitiesTier.ClIBGE;
import java.io.IOException;
import java.util.List;

/**
 *
 * @author Douglas
 */
public class IBGEBUS {
  public List<ClIBGE> listar() throws Exception
    {
        try
        {
            IBGEDAO dao = new IBGEDAO();
            return dao.todos();
        }
        catch(IOException  e)
        {
            System.err.println("Erro: " + e.getMessage());
            return null;
        }    
    }
    
    public ClIBGE buscar(String cod_ibge) throws Exception
    {
        try
        {
            IBGEDAO dao = new IBGEDAO();
            return dao.procurar_cod(cod_ibge);
        }
        catch(IOException  e)
        {
            System.err.println("Erro: " + e.getMessage());
            return null;
        }
    }
    
    public List <ClIBGE> buscar_cidade(String nm_localidade) throws Exception
    {
        try
        {
            IBGEDAO dao = new IBGEDAO();
            return dao.procurar(nm_localidade);
        }
        catch(IOException  e)
        {
            System.err.println("Erro: " + e.getMessage());
            return null;
        }
    }
}
